package musicstore.biz.impl;

import java.util.List;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import musicstore.biz.AlbumBiz;
import musicstore.dao.AlbumDao;
import musicstore.entity.Album;

public class AlbumBizImpl implements AlbumBiz{
	
	private AlbumDao albumDao;
	public void setAlbumDao(AlbumDao albumDao) {
		this.albumDao = albumDao;
	}

	@Override
	public List<Album> getAlbumsByDateReleased() {
		return albumDao.getAlbumsByDateReleased();
	}

	@Override
	public List<Album> getListByGenreId(int genreId, int pageNum, int pageSize) {
		return albumDao.getListByGenreId(genreId, pageNum, pageSize);
	}

	@Override
	public Album getAlbumById(int id) {
		return albumDao.getAlbumById(id);
	}

	@Override
	public List<Album> getListByGenreIdAndTitle(String title, int genreId,
			int pageNum, int pageSize) {
		return albumDao.getListByGenreIdAndTitle(title, genreId, pageNum, pageSize);
	}

	@Override
	public void add(Album album) {
		albumDao.add(album);
	}

	@Override
	public void update(Album album) {
		albumDao.update(album);
	}

	@Override
	public List<String> getTitleByPrefix(String title, int pageSize) {
		return albumDao.getTitleByPrefix(title, pageSize);
	}
	
	public static void main(String[] args) {
		AlbumBiz biz = new ClassPathXmlApplicationContext("beans.xml").getBean(AlbumBiz.class);
		biz.getAlbumById(1);
	}

}
